<?php
//print_r($_GET);die;//Array ( [ids] => 39,36, )
include_once("./function.php");
extract($_GET);//$ids
$ids=rtrim($ids,",");
//echo $ids;die;//39,36
$one=explode(",",$ids);
//print_r($one);die//;Array ( [0] => 39 [1] => 36 )
function getValue($arr)
{
 foreach($arr as $key => $value)
 {
  if(is_array($value)){
   getValue($value);
 }
 else
 {
   $value."<br>";
 }
 }
}
getValue($one);
//print_r($one);die;//Array ( [0] => 39 )
//print_r($one[0]);die;

for($i=0;$i<count($one);$i++)
{
	$sql="select * from ts_news where news_id='$one[$i]'";
	//echo $sql;die;
	$res=mysqli_query($link,$sql);
	if(is_object($res))
	{//echo mysqli_num_rows($res);die;
		if(mysqli_num_rows($res)==1)
		{
			$list=mysqli_fetch_assoc($res);	
		}
	}
	//print_r($list);die;
	if($list['new_img']!='')
	{
		$more=explode(",",$list['new_img']);
		foreach($more as $v)
		{
			unlink($v);
		}
	}
	$sql="delete from ts_news where news_id=$one[$i]";
	$res=mysqli_query($link,$sql);
	if($res)
	{
		if(mysqli_affected_rows($link)==1)
		{
			msg("删除成功","./news.php");
		}
		else
		{
			msg("删除失败","./news.php");exit;
		}
	}

}
?>